﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WindowsFormsApp1
{
    class DbHelper
    {
        private static string user = "server=.;database=MySchool;uid=sa;pwd=123456;";

       public static DataTable GetDataTable(String sql)
        {
            
            SqlConnection sqlConnection = new SqlConnection(user);
            sqlConnection.Open();
           

            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sql, sqlConnection);

            DataTable dataTable = new DataTable();

            sqlDataAdapter.Fill(dataTable);
            return dataTable;
        }
        

        


    }
}
